package com.leyou.config;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

//这是一个配置类,与属性结合使用,是springboot的属性配置方式
@Configuration
@EnableConfigurationProperties(JdbcConfigSpringBoot.class)
//通过@EnableConfigurationProperties(JdbcConfigSpringBoot.class)来声明要使用JdbcProperties这个类的对象
public class JdbcConfig {
    @Autowired
    private JdbcConfigSpringBoot jdbcConfigSpringBoot;
//
//    @Bean
//    public DataSource getDateSources() {
//        DruidDataSource dataSource = new DruidDataSource();
//        dataSource.setDriverClassName(jdbcConfigSpringBoot.getDriverClassName());
//        dataSource.setUrl(jdbcConfigSpringBoot.getUrl());
//        dataSource.setUsername(jdbcConfigSpringBoot.getUsername());
//        dataSource.setPassword(jdbcConfigSpringBoot.getPassword());
//        return dataSource;
//    }

}
